<?php $usr_data=$this->session->userdata("user_data"); if($usr_data['group']==1){?>
{_include user_menu}
<?php }  if($usr_data['group']==2){?>
{_include admin_menu}
<?php } ?>

<form action="<?php echo base_url('user/edituser'); ?>" id="signup-form" class="form-horizontal" method="post">
 <div class="content_block col-xs-12 col-sm-12 col-md-12 col-lg-12">
 <legend><b>Edit User&nbsp;&nbsp;(<?php echo $data[0]["username"]?>)</b></legend>
  <fieldset>


  <input type="hidden" name="id" value="<?php echo $data[0]['id']; ?>" />
    <div class="control-group">
      <label class="control-label" for="Firstname">Username</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" value="<?php echo $data[0]["username"]?>" disabled>
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="Password">Password</label>
      <div class="controls">
        <input type="password" class="input-xlarge required" name="password" id="password"  data-min-chars="6"value="" >
      </div>
    </div>
    <?php
    if(!empty($groups) AND $user_data['group'] == 2){ 
    ?>
    <div class="control-group">
        <label class="control-label" for="group">Group</label>
        <div class="controls">
          <select name="group">
            <?php foreach($groups as $group)  :?>
            <option value="<?php echo $group['id']  ?>" <?php if($group['id'] == $data[0]['group']){ ?> selected="selected" <?php } ?> >  <?php echo $group['name']?></option>
           <?php endforeach; ?>
          </select>
        </div>
      </div>
    <?php } ?>

    <hr />
    <div class="control-group">
      <label class="control-label" for="Firstname">First Name</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="firstname" id="firstname"value="<?php echo $data[0]["firstname"]?>">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="Lastname">Last Name</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="lastname" id="lastname" value="<?php echo $data[0]["lastname"]?>" >
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="Lastname">Email</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" data-min-chars="5" data-email name="email" id="email" value="<?php echo $data[0]["email"]?>" >
        <span class="emailalert" style="display:none;">Available</span>
      </div>
    </div>

    <div class="control-group">
      <label class="control-label" for="Lastname">Facebook</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" data-min-chars="5" data-email name="facebook" id="facebook" value="<?php echo $data[0]["facebook"]?>">
        <span class="emailalert" style="display:none;">Available</span>
      </div>
    </div>
    

    <div class="control-group">
      <label class="control-label" for="Lastname">Line</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" data-min-chars="5"  name="line" id="line" value="<?php echo $data[0]["line"]?>" >
        <span class="emailalert" style="display:none;">Available</span>
      </div>
    </div>


    <!--
    <div class="control-group">
      <label class="control-label" for="Confirmpassword">Confirm Password</label>
      <div class="controls">
        <input type="password" class="input-xlarge required" name="confirmpassword" id="confirmpassword"  >

      </div>
    </div>
    <div class="control-group">
      <div class="controls">
        <span class="passwordalert" style="display:none;">Password Not Match.</span>
      </div>
    </div>
     -->
    <div class="controll-group">
      <label class="control-label">Gender</label>
      <div class="controls">
        <label class="radio inline">
          <input type="radio" name="gender" value="m" id="gender m" class="input-xlarge required">Man</label>
        <label class="radio inline">
          <input type="radio" name="gender" value="f" id="gender w" class="input-xlarge " >Woman</label>
      </div>
    </div>
    <br />
    <div class="control-group">
      <label class="control-label" for="Mobile">Mobile</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="mobile" id="mobile" data-int data-max-chars="11"value="<?php echo $data[0]["mobile"]?>">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="Phone">Phone</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="phone" id="phone" data-int data-max-chars="10" value="<?php echo $data[0]["phone"]?>" >
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="Address">Address</label>
      <div class="controls">
        <textarea class="input-xlarge required" name="address"  rows="3" id="address"><?php echo $data[0]["address"]?></textarea>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="District">District</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="district" id="district" value="<?php echo $data[0]["district"]?>">
      </div>
    </div>
     <div class="control-group">
      <label class="control-label" for="Province">Province</label>
      <div class="controls">
      <select name="province" id="province" class="required">
  			<?php
          $provinces = $this->config->item("province");
          foreach ($provinces as $key => $value) {
            if($data[0]["province"] == $key){
              ?>
              <option value="<?php echo $key;?>" selected><?php echo $value;?></option>
              <?php
            }else{
              ?>
              <option value="<?php echo $key;?>"><?php echo $value;?></option>
              <?php
            }
          }
        ?>
		  </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label" for="Zipcode">Zip Code</label>
      <div class="controls">
        <input type="text" class="input-xlarge required" name="zipcode" id="zipcode" data-int data-max-chars="6"value="<?php echo $data[0]["zipcode"]?>">
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary btn-large" id="submitbtn" name="submitbtn" value="submitbtn">Submit</button>
      <button type="reset" class="btn">Cancel</button>
    </div>



</fieldset>
</div>
</form>
